//
//  MMRightActionView.m
//  MemeMaker
//
//  Created by Phan Quang Ha on 7/29/13.
//  Copyright (c) 2013 soyo. All rights reserved.
//

#import "MMRightActionView.h"

@implementation MMRightActionView

- (id)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        // Initialization code
    }
    return self;
}

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect
{
    // Drawing code
}
*/

- (void)awakeFromNib
{
    [super awakeFromNib];
    _btnPencil.selected = YES;
}

- (IBAction)tapUndo:(UIButton *)sender {
}

- (IBAction)tapRedo:(UIButton *)sender {
}

- (IBAction)tapEraser:(UIButton *)sender {
    sender.selected = YES;
    _btnPencil.selected = NO;
}

- (IBAction)tapPen:(UIButton *)sender {
    sender.selected = YES;
    _btnEraser.selected = NO;
}
- (void) setHidden:(BOOL)hidden
{
    if (hidden) {
        [UIView animateWithDuration:0.3f animations:^{
            CGRect frame = self.frame;
            frame.origin.x = frame.origin.x + frame.size.width;
            self.frame = frame;
        } completion:^(BOOL finished) {
            [super setHidden:hidden];
        }];
    }else{
        [super setHidden:hidden];
        [UIView animateWithDuration:0.3f animations:^{
            CGRect frame = self.frame;
            frame.origin.x = frame.origin.x - frame.size.width;
            self.frame = frame;
        }];
    }
}
@end
